//package com.aranandroid.customview.dialog
//
//import android.annotation.SuppressLint
//import android.app.Activity
//import android.app.Dialog
//import android.content.Context
//import android.os.Bundle
//import android.text.TextUtils
//import android.view.Gravity
//import android.view.LayoutInflater
//import android.view.View
//import android.view.ViewGroup
//import android.widget.TextView
//import com.aranandroid.customview.R
//import com.aranandroid.customview.dialog.timepicker.MyWheelView
//
//
//@SuppressLint("InflateParams")
//class BottomDialog(
//    context: Context,
//    data: List<String>,
//    selectPosition: Int
//) : Dialog(context, R.style.DialogTheme) {
//    private val context: Activity
//    private val view: View?
//    private val viewHolder: ViewHolder?
//    private var mData: List<String>
//    private var select: String? = null
//    private var selectPosition = -1
//    private var title: String? = null
//    override fun onCreate(savedInstanceState: Bundle?) {
//        super.onCreate(savedInstanceState)
//        init()
//        view?.let { setContentView(it) }
//    }
//
//    private fun init() {
//        if (viewHolder != null) {
//            // 滚动监听
//            viewHolder.loopView.setListener { index ->
//                selectPosition = index
//                select = mData[index]
//            }
//            // 设置原始数据
//            viewHolder.loopView.setItems(mData)
//            if (selectPosition > 0) {
//                viewHolder.loopView.setInitPosition(selectPosition)
//            }
//            viewHolder.okBottom.setOnClickListener(View.OnClickListener {
//                if (selectPosition < 0) {
//                    selectPosition = 0
//                }
//                if (onClickMyListener != null) {
//                    onClickMyListener!!.onClick(select, selectPosition)
//                    dismiss()
//                }
//            })
//            if (!TextUtils.isEmpty(title)) {
//                viewHolder.title.text = title
//            }
//        }
//    }
//
//    fun setTitleText(title: String?): BottomDialog {
//        this.title = title
//        return this
//    }
//
//    private var onClickMyListener: OnClickMyListener? = null
//    fun setOnClickMyListener(onClickMyListener: OnClickMyListener?): BottomDialog {
//        this.onClickMyListener = onClickMyListener
//        return this
//    }
//
//    interface OnClickMyListener {
//        fun onClick(text: String?, selectPosition: Int)
//    }
//
//    internal class ViewHolder(view: View) {
//        val okBottom: TextView = view.findViewById(R.id.dialog_device_bootom)
//        val title: TextView
//        val loopView: MyWheelView
//
//        init {
//            title = view.findViewById(R.id.dialog_title)
//            loopView = view.findViewById(R.id.loopView)
//        }
//    }
//
//    init {
//        this.context = context as Activity
//        mData = data
//        this.selectPosition = selectPosition
//        setCanceledOnTouchOutside(true)
//        window!!.setGravity(Gravity.BOTTOM)
//        window!!.setWindowAnimations(R.style.bottom_menu_animStyle)
//        window!!.setLayout(
//            ViewGroup.LayoutParams.MATCH_PARENT,
//            ViewGroup.LayoutParams.WRAP_CONTENT
//        )
//        window!!.decorView.setPadding(0, 0, 0, 0)
//        window!!.decorView.minimumWidth = context.getResources().displayMetrics.widthPixels
//        view = LayoutInflater.from(context).inflate(R.layout.dialog_device_bottom, null)
//        viewHolder = ViewHolder(view)
//    }
//}